#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>

char *newnew =(char*)"MYVAL=1234";

 char *const env[] = {
(char *const)"MYVAL=123456",
 NULL
};

int main()
{

    printf("程序开始运行！\n");
    if(fork() == 0)
    {
        char *const argv[] = {
            (char*const)"./other",
            (char*const)"-l",
            (char*const)"-a",
            NULL
        };
       for(int i = 0; env[i]; i++)
       {
           putenv(env[i]);
       }
       //putenv(newnew);
        extern char ** environ;
        execvpe("./other",argv,environ);
        //execvp("./other",argv);
        //execv("/usr/bin/ls",argv);
        //execl("/usr/bin/ls","ls","-l","-a",NULL);
        //execlp("ls","ls","-l","-a",NULL);
        //exe1cl("./other","other",NULL);
        
        exit(1);
    }
    
    waitpid(-1,NULL,0);
    printf("程序运行结束！\n");
    return 0;
}
